<template>
    <el-dialog
        :visible.sync="showValue"
        append-to-body
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        width="950px"
        top="30px"
        :close="clearData"
        :before-close="clearData"
    >
        <div class="wrap">
            <h1 class="title">{{ form.title }}</h1>
              <div class="time">发布时间：{{form.createTime}}</div>
              <div class="line"></div>
            <div class="content" v-html="form.content"></div>
        </div>
    </el-dialog>
</template>

<script>
export default {
    props: {
        value: Boolean,
        currRow: Object
    },
    data () {
        return {
            zdList: [],
            currentPage: 1,
            pageSize: 10,
            totalNum: 0,
            loading: false,
            tableData: [],
            showValue: false,
            terminalTypeList: [],
            packageFileTypeList: [],
            form: {
                title: '',
                content: ''
            }
        }
    },
    watch: {
        value (val) {
            this.showValue = val
        },
        showValue (val) {
            if (val) {
                this.getDetail()
            }
            this.$emit('update:value', val)
        }
    },
    created () {
    },
    methods: {
        // 获取列表
        async getDetail () {
            const res = await this.$http.get(this.$store.state.IP + `/notify/announce/user/announce/detail?id=${this.currRow.id}`, {
            })
            let response = res.data
            if (response.ret === '0') {
                this.form = response.data
            }
        },
        // 清空数据
        clearData () {
            this.form = {
                title: '',
                content: ''
            }
            this.$emit('refreshList')
            this.showValue = false
        }
    }
}
</script>
<style lang="stylus" rel="stylesheet/stylus" scoped>
.line
    height:1px
    margin: 24px 0;
    background-color: #DCDFE6;
.wrap
    height 500px
    overflow auto
    .title
        text-align center
        font-size 26px
        margin-bottom 20px
    .time
        color: #999
        font-size 14px
.item
    width: 110px

.right
    text-align: right
</style>